home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: Problem Negating an Unsigned Char
- Date: Tue, 05 Mar 96 23:12:14 GMT
- Organization: none
- Message-ID: <826067534snz@genesis.demon.co.uk>
- References: <Dnnros.Lq.0.-s@hkusuc.hku.hk> <TANMOY.96Mar2222131@qcd.lanl.gov>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <TANMOY.96Mar2222131@qcd.lanl.gov>
- tanmoy@qcd.lanl.gov "Tanmoy Bhattacharya" writes:
-
- >The problem is that before the application of almost any arithmetic or
- >bit manipulation operators, `integral promotions' take place. These
- >change char and signed and unsigned char and short to either int ot
- >unsigned int (depending on how big they are).
-
- To be 100% clear 'they' refers to the types rather than the values they
- happen to hold at the time and is always determinable at compile time.
- So if UCHAR_MAX is less than or equal to INT_MAX then unsigned chars promote
- to ints, otherwise they promote to unsigned ints.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-